<?php

namespace common\components;

/**
 * @author  shuang
 * @date    2017-2-24 9:57:18
 * @version V1.0
 * @desc    
 */
use yii\web\Controller;
use common\filters\LoginFilter;
use Yii;

class WController extends Controller {

    public function behaviors() {
        return [
            'login' => [
                'class' => LoginFilter::className()
            ],
        ];
    }

    public function afterAction($action, $result) {
        if (!Yii::$app->user->isGuest) {
            if (Yii::$app->user->identity->froststatus == 0) {
                $event = new TaskEvent();
                $this->on("mywork_list", [$event, "timingCashback"], [
                    "userid" => Yii::$app->user->id,
                    "type" => 1,
                    "class_type" => 3
                ]);
                $this->trigger("mywork_list", $event);
                $this->off("mywork_list");
                $event2 = new OperateEvent();
                $this->on("reflash_list", [$event2, "reflashTasklist"]);
                $this->trigger("reflash_list", $event2);
                $this->off("reflash_list");
            }
        }
        if (Yii::$app->user->identity->froststatus > 0) {
            Yii::$app->controller->redirect(["site/frost"], 301);
        }
        return parent::afterAction($action, $result);
    }

}
